package com.fozu.office.system.service;
import java.util.List;

import org.apache.ibatis.annotations.Param;
/*
 * 员工管理
 */
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fozu.office.system.dao.UserDao;
import com.fozu.office.system.entity.UserVO;

@Service("userService")
@Transactional(readOnly=true)
public class UserServiceImpl {
	@Autowired
	private UserDao udao;
	//登录
	public UserVO login(UserVO userVO){
		return udao.login(userVO);
	}
	//用户列表(分页)
	public IPage<UserVO> listUser(Page<UserVO> page,UserVO user){
		return udao.listUser(page,user);
	}
	//添加用户
	@Transactional(readOnly=false)
	public void addUser(UserVO user){
		udao.addUser(user);
	}
	//根据id批量删除用户(更改status状态)
	@Transactional(readOnly=false)
	public void delUserByIds(String[] ids){
		UserVO user =new UserVO();
		for (String id : ids) {
			user.setId(id);
			udao.delUserById(user);
		}
		
	}
	//根据id获取user对象
	public UserVO getUserById(UserVO  user){
		return udao.getUserById(user);
	}
	//修改用户信息
	@Transactional(readOnly=false)
	public void updateUser(UserVO user){
		udao.updateUser(user);
	}
	//修改用户状态
	@Transactional(readOnly=false)
	public void updateStatus(UserVO user){
		udao.updateStatus(user);
	}
	//获取姓名、id
	public List getUserIds(){
		return udao.getUserIds();
	}
}
